﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReturnedShopping.aspx.cs" Inherits="Web.User.Exchange.Returned.ReturnedShopping" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script src="../../../Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="../../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="../../../Scripts/WebInner.js" type="text/javascript"></script>
    <script src="../../../Scripts/Common.js" type="text/javascript"></script>
    <link href="../../../Styles/Common.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/Zebra/zebra_dialog.js" type="text/javascript"></script>
    <link href="../../../Scripts/Zebra/zebra_dialog.css" rel="stylesheet" type="text/css" />
    <script src="../../../Lodop6.198/LodopFuncs.js" type="text/javascript"></script>
      <script type="text/javascript">
          //存转销中一次只允许退还一条记录
          /*--------窗体启动设置和基本设置--------*/
          /*--loadFuntion--*/
          $(function () {

              var now = new Date(); //获取系统日期，即Sat Jul 29 08:24:48 UTC+0800 2006 
              var yy = now.getFullYear(); //截取年，即2006 
              var mo = now.getMonth() + 1; //截取月，即07 
              var dd = now.getDate(); //截取日，即29 
              //取时间 
              var hh = now.getHours(); //截取小时，即8 
              var mm = now.getMinutes(); //截取分钟，即34 
              var ss = now.getSeconds(); //获取秒 
              $('#dt_GuaShi').val(yy + '-' + mo + '-' + dd + ' ' + hh + ':' + mm + ':' + ss);

          });


          /*--ENd loadFuntion--*/



          //选择兑换商品
          function FunSelect(obj, exid) {

              $('input[name=IDList]').val(exid);

          }

          function frmSubmit() {
              var IDList = $('input[name=IDList]').val();

              if ($.trim(IDList) == '') {
                  $.Zebra_Dialog('<strong> 请选择要退还的信息 ！</strong>');
                  return;
              } else {

                  var BusinessNO = $('input[name=BusinessNO]').val();
                  if (confirm('您确认已经认真检查提交信息，并继续操作吗？')) {
                      $.ajax({
                          url: '/Ashx/exchangeprop.ashx?type=Return_StorageShopping&IDList=' + IDList + '&BusinessNO=' + BusinessNO,
                          type: 'post',
                          data: '',
                          dataType: 'text',
                          success: function (r) {
                              $.Zebra_Dialog('<strong> 该笔换购记录已成功退还 ！</strong>');
                              $('#btnSave').attr('disabled', 'disabled');
                              $('#btnSave').css('background', '#aaa');
                              $('#btnPrint').removeAttr('disabled');
                              $('#btnPage').removeAttr('disabled');

                          }, error: function (r) {
                              $.Zebra_Dialog('<strong> 退还操作失败 ！</strong>');
                          }
                      });
                  }

              }



          }


          /*--------End 数据增删改操作--------*/

          var p_left = 0; var p_ltop = 0; var p_lwidth = 0; var p_lheight = 0;
          $(function () {
              $.ajax({
                  url: '/Ashx/wbinfo.ashx?type=GetPrintSetting_Dep',
                  type: 'post',
                  data: '',
                  dataType: 'json',
                  success: function (r) {
                      p_lwidth = r[0].Width;
                      p_lheight = r[0].Height;
                      p_lleft = r[0].DriftRateX;
                      p_ltop = r[0].DriftRateY;
                  }, error: function (r) {
                      $.Zebra_Dialog('<strong>加载打印坐标时出现错误 ！</strong>');
                  }
              });
          });
          //存折打印
          function CreateOneFormPage() {
              LODOP = getLodop();
              LODOP.PRINT_INIT("存折打印");
              LODOP.SET_PRINT_STYLE("FontSize", 18);
              LODOP.SET_PRINT_STYLE("Bold", 1);
              LODOP.ADD_PRINT_TEXT(0, 0, 0, 0, "打印页面部分内容");

              LODOP.ADD_PRINT_HTM(p_ltop, p_lleft, p_lwidth, p_lheight, document.getElementById("divPrint").innerHTML);

          };



          //加载新的业务编号
          function InitBusinessNO() {
              $.ajax({
                  url: "/User/Storage/storage.ashx?type=GetNewBusinessNO&AccountNumber=" + $('#D_AccountNumber').html(),
                  type: 'post',
                  data: '',
                  dataType: 'text',
                  success: function (r) {
                      $('input[name=BusinessNO]').val(r);

                      frmSubmit(); //提交表单
                  }, error: function (r) {
                      $.Zebra_Dialog('<strong>加载信息失败 ！</strong>');
                  }
              });
          }


          function PrintCunZhe() {

              $.ajax({
                  url: '/Ashx/storage.ashx?type=PrintDep_OperateLog&BusinessNO=' + $('input[name=BusinessNO]').val() + '&AccountNumber=' + $('#D_AccountNumber').html(),
                  type: 'post',
                  data: '',
                  dataType: 'text',
                  success: function (r) {
                      $('#divPrint').html('');
                      $('#divPrint').append(r);
                      CreateOneFormPage();
                      LODOP.PREVIEW(); //打印存折
                  }, error: function (r) {
                      $.Zebra_Dialog('<strong>加载打印坐标时出现错误 ！</strong>');
                  }
              });
          }



          function PrintPage() {
              $.ajax({
                  url: '/Ashx/storage.ashx?type=PrintStorageShopping&BusinessNO=' + $('input[name=BusinessNO]').val() + '&AccountNumber=' + $('#D_AccountNumber').html() + '&model=return',
                  type: 'post',
                  data: '',
                  dataType: 'text',
                  success: function (r) {
                      $('#divPage').html('');
                      $('#divPage').append(r);
                      CreatePage();
                      LODOP.PREVIEW(); //打印存折
                  }, error: function (r) {
                      $.Zebra_Dialog('<strong>加载打印坐标时出现错误 ！</strong>');
                  }
              });

          }

          //小票打印
          function CreatePage() {
              LODOP = getLodop();
              LODOP.PRINT_INIT("小票打印");
              LODOP.SET_PRINT_STYLE("FontSize", 12);
              LODOP.SET_PRINT_STYLE("Bold", 1);
              LODOP.ADD_PRINT_TEXT(0, 0, 0, 0, "打印页面部分内容");

              LODOP.ADD_PRINT_HTM(20, 60, 800, 400, document.getElementById("divPage").innerHTML);

          };



      

      </script>
</head>
<body>
 <div id="divPrint" style="display:none">

    </div>
   <div id="divPage" style="display:none">

    </div>
    <form id="form1" runat="server">
    <div class="pageHead">
        <b>退还产品换购</b><%--<span id="spanHelp" style="cursor: pointer">帮助</span>--%>
    </div>
    <div id="divHelp" class="pageHelp">
        <span>提示1：首先找到储户信息与存转销 信息，选择对应的存转销退还</span><br />
        <span>提示2：营业员可以退还当日存转销数据，管理员可以按原数退还储户所有存转销数据</span><br />
    </div>
<div id="storageQuery">

</div>
    <div style="margin: 20px 0px;">
        <div id="Query">
            <span>储户账号:</span>
            <input type="text" id="QAccountNumber" style="font-size:16px; font-weight:bolder;" runat="server" />
          &nbsp; <span>密码:</span>
            <input type="password" id="QPassword" style="font-size:12px;  width:100px;" runat="server" />
            <asp:ImageButton ID="ImageButton1" ImageUrl="~/images/seach_brown.png" 
                runat="server" onclick="ImageButton1_Click" />
        </div>
        <div id="depositorInfo" runat="server"  style="display:none;">
            <table class="tabData"  style="margin:20px 0px;">
                <tr >
                    <td colspan="6" style="border-bottom:1px solid #aaa; height:25px; text-align:center">
                        <span style="font-size: 16px; font-weight: bolder; color:Green">储户基本信息</span>
                    </td>
                </tr>
                <tr>
                    <th align="center" style="width:100px; height:30px;">
                        储户账号
                    </th>
                    <th align="center" style="width:100px;">
                        储户姓名
                    </th>
                     <th align="center" style="width:100px;">
                        移动电话
                    </th>
                      <th align="center" style="width:100px;">
                        当前状态
                    </th>
                      <th align="center" style="width:150px;">
                        身份证号
                    </th>
                     <th align="center" style="width:200px;">
                        储户地址
                    </th>
                   
                </tr>
                   <tr>
                  
                    <td style="height:30px;">
                        <span style="font-weight:bolder; color:Blue;" id="D_AccountNumber"   runat="server"></span>
                    </td>
                    
                    <td>
                        <span style="font-weight:bolder; color:Blue;" id="D_strName" runat="server"></span>
                    </td>
                    <td>
                        <span style="font-weight:bolder; color:Blue;" id="D_PhoneNo" runat="server"></span>
                    </td>
                     <td>
                        <span style="font-weight:bolder; color:Blue;" id="D_numState" runat="server"></span>
                    </td>
                      <td>
                        <span style="font-weight:bolder; color:Blue;" id="D_IDCard" runat="server"></span>
                    </td>
                    <td>
                        <span style="font-weight:bolder; color:Blue;" id="D_strAddress" runat="server"></span>
                    </td>
                </tr>
            </table>
        </div>
        <div id="StorageList" runat="server">
        <asp:Repeater ID="Repeater1" runat="server">
            <HeaderTemplate>
                <table class="tabData" >
                    <tr class="tr_head">
                        <th style="width: 100px; height:20px; text-align: center;">
                            存贷产品
                        </th>
                        <th style="width: 80px; text-align: center;">
                            结存数量
                        </th>
                        <th style="width: 100px; text-align: center;">
                            存入时间
                        </th>
                        <th style="width: 80px; text-align: center;">
                            存入价
                        </th>
                        <th style="width: 80px; text-align: center;">
                            存期
                        </th>
                        <th style="width: 80px; text-align: center;">
                            天数
                        </th>
                        <th style="width: 80px; text-align: center;">
                            活期利率
                        </th>
                        <th style="width: 100px; text-align: center;">
                            利息
                        </th>
                      
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr style='background-color: <%#(Container.ItemIndex%2==0)?"#FFFFF;":"#fcf3f4"%>'
                    onmouseover="change_colorOver(this)" onmouseout="change_colorOut(this)">
                    <td style="height:25px;">
                        <%#Eval("VarietyID")%>
                    </td>
                    <td>
                        <%#Eval("StorageNumber")%>
                    </td>
                    <td>
                        <%#Eval("StorageDate")%>
                    </td>
                    <td>
                        <%#Eval("Price_ShiChang")%>
                    </td>
                    <td>
                        <%#Eval("TimeID")%>
                    </td>
                    <td>
                        <%#Web.common.GetDay(Eval("StorageDate"))%>
                    </td>
                    <td>
                        <%#Eval("CurrentRate")%>
                    </td>
                    <td>
                        <%#Web.common.GetLiXi(Eval("ID"))%>
                    </td>
                    
                </tr>
            </ItemTemplate>
            <FooterTemplate>
            <tr>
            <td colspan="2">
            <span style="font-weight:bolder">折合现金合计:</span>
            </td>
            <td colspan="6" style="text-align:center">
            <span id="spanTotal" runat="server" style="color:Red; font-size:16px">￥<%=Web.common.numTotol%></span>
          
            </td>
            </tr>
                <!--底部模板-->
                </table>
                <!--表格结束部分-->
            </FooterTemplate>
        </asp:Repeater>
        </div>

        <div id="exchangeList" style="margin:20px 0px;">
        <span style="font-size:16px; font-weight:bolder;">储户今日产品换购信息</span>
        
            <asp:Repeater ID="Repeater2" runat="server">
                <HeaderTemplate>
                    <table class="tabData">
                        <tr class="tr_head">
                            <th style="width: 100px; height: 20px; text-align: center;">
                               结算类型
                            </th>
                            <th style="width: 80px; text-align: center;">
                                结算日期
                            </th>
                            <th style="width: 100px; text-align: center;">
                                存储产品
                            </th>
                            <th style="width: 80px; text-align: center;">
                                实存天数
                            </th>
                            <th style="width: 80px; text-align: center;">
                                结算重量
                            </th>
                            <th style="width: 80px; text-align: center;">
                                利息
                            </th>
                            <th style="width: 80px; text-align: center;">
                                结算金额
                            </th>
                            <th style="width: 100px; text-align: center;">
                                退还
                            </th>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr style='background-color: <%#(Container.ItemIndex%2==0)?"#FFFFF;":"#fcf3f4"%>'
                        onmouseover="change_colorOver(this)" onmouseout="change_colorOut(this)">
                        <td style="height: 25px;">
                            <%#Eval("BusinessName")%>
                        </td>
                        <td>
                            <%#Eval("dt_Sell")%>
                        </td>
                        <td>
                            <%#Eval("VarietyName")%>
                        </td>
                        <td>
                            <%#Eval("StorageDate")%>
                        </td>
                        <td>
                            <%#Eval("VarietyCount")%>
                        </td>
                        <td>
                            <%#Eval("VarietyInterest")%>
                        </td>
                        <td>
                            <%#Eval("VarietyMoney")%>
                        </td>
                        <td>
                           <%-- <input type="checkbox" name="chkExchange" onclick="FunSelect(this,<%#Eval("ID") %>)" value="<%#Eval("ID") %>" />选择--%>
                            <input type="radio" name="chkExchange" onclick="FunSelect(this,<%#Eval("ID") %>)" value="<%#Eval("ID") %>" />选择
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                   
                    <!--底部模板-->
                    </table>
                    <!--表格结束部分-->
                </FooterTemplate>
            </asp:Repeater>
        </div>
        <div id="divNO"  runat="server" style="color:Red; font-weight:bold;display:none;">该储户今日没有产品换购信息</div>
        <div id="divYes" style="display:none" runat="server">
      <input type="button" id="btnSave" value="确认并退还" style="width:120px; font-size:18px; font-weight:bolder; color:Blue; border:1px solid #888;" onclick="InitBusinessNO()" />&nbsp;&nbsp;
                     
                         <input type="button" id="btnPrint" value="打印存折" disabled="disabled" onclick="PrintCunZhe()" />&nbsp;
                       <input type="button" id="btnPage" value="打印小票"  disabled="disabled" onclick="PrintPage()" />
                     
        </div>
    </div>
 
    <div  style="display:none;">
      <%--业务编号--%>
      <input type="text"  name="BusinessNO" value="" />
    <%--兑换业务编号集合--%>
   <input type="text" name="IDList"  />
    </div>
    </form>
    
    <%--定义编号--%>
    <input type="hidden" id="WBID" value="" />
    <%--定义背景色的隐藏域--%>
    <input type="hidden" id="colorName" value="" />
</body>
</html>



